<!-- 文章详情 -->
<template>
  <div class="article">
    <!-- 轮播图 -->
    <div class="swiper">
      <el-carousel height="300px">
        <el-carousel-item v-for="item in 1" :key="item">
          <img
            style="width: 100%; height: 100%; object-fit: cover"
            src="@/assets/img/home/u13.png"
            alt=""
            srcset=""
          />
        </el-carousel-item>
      </el-carousel>
    </div>
    <div class="container">
    <!-- 头部导航 -->
    <div class="header">
      <span class="header-tit">{{ title }}</span>&nbsp;&nbsp;&nbsp;
      <!-- <i class="header-tit el-icon-arrow-right"></i> -->
      <span class="header-tit" v-if="dataPage.publishedAt">{{ dataPage.publishedAt }}</span>
    </div>

    <!-- 内容 -->
    <div class="content wrap" v-html="dataPage.content">
    </div>
    </div>
  </div>
</template>

<script>
import { get } from "../api";
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
export default {
  name: "Article",
  data() {
    return {
      id: 0,
      title: '',
      dataPage: {},
    };
  },
  mounted() {
    this.id = this.$route.query.id;
    this.title = this.$route.query.title;
    // this.getNavList();
    this.getData(this.id);
  },
  methods: {
    // getNavList() {
    //   this.$store.state.header.forEach((item) => {
    //     if (item.name == this.navName) {
    //       this.navList = item.children;
    //     }
    //   });
    // },
    //新闻资讯请求
    async getData(id) {
      try {
        const response = await get("/con/content/getContentInfo/" + id);
        this.dataPage = response.resData;
        console.log(response)
        // 处理响应数据
      } catch (error) {
        // 处理错误
      }
    },
  },
};
</script>

<style lang='css' scoped>
/**轮播图 */
.swiper {
  margin: auto;
  overflow: hidden;
}

.container {
  max-width: 1300px;
  margin: auto;
  padding: 0 10px;
  box-sizing: border-box;
}

/**导航 */
.header {
  margin-top: 20px;
  padding: 5px 10px;
  box-sizing: border-box;
  background-color: #3da1e0;
}

.header-tit {
  font-weight: bold;
  font-size: 16px;
  color: #fff;
}

/**内容 */
.content {
  border-top: 2px solid #9f9fa0;
  margin: 20px auto;
  background-color: #eaeff2;
  padding: 10px;
  font-size: 20px;
  line-height: 2;
  text-indent: 2em;
  font-family: fangsong;
  letter-spacing: 3px;
}
</style>
